Skip to content

feat: add CVE-2026-31431 copy-fail privilege escalation exploit#130

Merged
neargle merged 3 commits into
mainfrom
copilot/add-new-exp-and-tests
Apr 30, 2026
Merged

feat: add CVE-2026-31431 copy-fail privilege escalation exploit#130
neargle merged 3 commits into
mainfrom
copilot/add-new-exp-and-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

Ports the copy-fail CVE-2026-31431 PoC into CDK as a native Go plugin under privilege-escalation.

Exploit mechanism

Abuses a kernel bug in the AF_ALG AEAD socket + splice/pipe interaction. By issuing sendmsg(MSG_MORE) with attacker-controlled data and then splicing read-only file pages into the same socket's pipe buffers, the kernel writes the attacker data back into those page-cache pages — without touching the on-disk file (stealthy). A compressed 160-byte ELF64 shellcode blob (setuid(0) + execve("/bin/sh")) is injected into a SUID binary's page cache, then the binary is executed to obtain a root shell.

New files

  • pkg/exploit/privilege_escalation/copy_fail_cve_2026_31431.go

    • copyFailDecompressPayload() — decompresses the embedded zlib/ELF64 shellcode payload
    • buildAlgCmsg() — builds cmsghdr control-message records portably via syscall.CmsgLen/CmsgSpace
    • copyFailWriteChunk(fd, offset, chunk) — core primitive: AF_ALG socket setup → sendmsg(MSG_MORE)splice(file→pipe→ALG) → drain recv; repeats for each 4-byte chunk
    • CopyFailExploit(targetBin) — orchestrates chunk writes then execs the target with inherited stdio
    • Registered as plugin copy-fail-cve-2026-31431 (privilege-escalation)
  • pkg/exploit/privilege_escalation/copy_fail_cve_2026_31431_test.go

    • Tests payload decompression (ELF magic, length), buildAlgCmsg structure (alignment, header fields, data placement), and plugin registration

Usage

./cdk run copy-fail-cve-2026-31431 [/usr/bin/su]

…uivalents

syscall.SYS_SETSOCKOPT and syscall.SYS_ACCEPT are not defined on all
Linux architectures (e.g. arm64). Switch to unix.Syscall6/unix.SYS_SETSOCKOPT
and unix.Accept which are provided by golang.org/x/sys/unix and work
consistently across all supported platforms.

Fixes the build failure reported in CI job 73707270282.
@neargle neargle merged commit 12ed027 into main Apr 30, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants